<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>组件使用中的细节点-2</title>
  <script src="../asset/js/vue.js"></script>
</head>

<body>
  <div id="root">
    <div ref='hello' @click='handleClick'>hello world</div>
  </div>
  <script>
    let vm = new Vue({
      el: '#root', //vue接管的区域
      methods: {
        handleClick() {
          // this.$refs指的是整个Vue实例里面所有的引用,获取ref名的dom
          let $hello = this.$refs.hello
          console.log($hello.innerHTML)
        }
      }
    })

  </script>
</body>

</html>
